package com.wct.springcloud.controller;

import com.wct.springcloud.model.Dept;
import com.wct.springcloud.service.DeptService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author WEI (Email:changtan20000@163.com)
 * @description
 * @date: 2019/12/11 15:31
 */
@Slf4j
@RestController
public class DeptController {

    @Autowired
    private DeptService deptService;

    @PostMapping(value = "/dept/add")
    public boolean add(@RequestBody Dept dept) {
        log.info("/dept/add/ dept: {}", dept.toString());
        return deptService.add(dept);
    }

    @GetMapping(value = "/dept/get/{id}")
    public Dept get(@PathVariable("id") Integer id) {
        log.info("/dept/get/ id: {}", id.toString());
        return deptService.get(id);
    }

    @GetMapping(value = "/dept/list")
    public List<Dept> list() {
        log.info("/dept/list list: ");
        return deptService.list();
    }

    @GetMapping(value = "dept/discovery")
    public Object discovery() {
        return null;
    }
}
